package giaodien;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSeparator;
import component.MyButton;

public class DangNhap extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JComboBox<Object> cbuser=new JComboBox<Object>();
	JPasswordField pxtpass=new JPasswordField(20);
	public MyButton dangnhap=new MyButton(" Login");
	public MyButton huy=new MyButton("Cancle");
	public MyButton option=new MyButton("Option");
	JComboBox<Object> comdatabase=new JComboBox<Object>();
	JComboBox<Object> comUser=new JComboBox<Object>();
	JPasswordField pxtdatabase=new JPasswordField();
	
	JPanel pn1=new JPanel();
		public DangNhap() {
		setTitle("Đăng Nhập");
		setIconImage(Toolkit.getDefaultToolkit().getImage("image/agt-login-icon.png"));
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		setAlwaysOnTop(true);
		setSize(440,244);
		setLocation((Toolkit.getDefaultToolkit().getScreenSize().width-getWidth())/2, (Toolkit.getDefaultToolkit().getScreenSize().height-getHeight())/2);
		setResizable(false);
		giaoDien();
	}
	public void giaoDien(){
		cbuser.setEditable(true);
		cbuser.setForeground(Color.blue);
		pxtpass.setForeground(Color.blue);
		JPanel pn1=new JPanel();
		pn1.setLayout(new BoxLayout(pn1, BoxLayout.Y_AXIS));
		pn1.add(Box.createRigidArea(new Dimension(0, -5)));
		add(pn1);
		
		JPanel toppn=new JPanel(new FlowLayout(FlowLayout.CENTER));
		JLabel lable=new JLabel(new ImageIcon("image/login1.jpg"));
		toppn.add(lable);
		pn1.add(toppn);
		
		JPanel centerpn1=new JPanel();
		centerpn1.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0));
		JLabel lbuser=new JLabel("User");
		lbuser.setBorder(BorderFactory.createEmptyBorder(5, 60, 10, 31));
		cbuser.setPreferredSize(new Dimension(223, 25));
		centerpn1.add(lbuser);
		centerpn1.add(cbuser);
		pn1.add(centerpn1);
		
		JPanel centerpn2=new JPanel();
		centerpn2.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0));
		JLabel lbpass=new JLabel("Password");
		lbpass.setBorder(BorderFactory.createEmptyBorder(5, 60, 5, 0));
		pxtpass.setPreferredSize(new Dimension(220, 25));
		centerpn2.add(lbpass);
		centerpn2.add(pxtpass);
		pn1.add(centerpn2);
		
		JPanel bottompn=new JPanel();
		bottompn.setLayout(new FlowLayout(FlowLayout.RIGHT,12,10));
		bottompn.add(dangnhap);
		bottompn.add(huy);
		bottompn.add(option);
		
		JSeparator separator = new JSeparator();
	    separator.setForeground(Color.gray);
		pn1.add(bottompn);
		pn1.add(separator);
		
		JPanel pnphu1=new JPanel();
		pnphu1.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10));
		JLabel database=new JLabel("Database");
		database.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 5));
		comdatabase.setPreferredSize(new Dimension(320, 25));
		pnphu1.add(database);
		pnphu1.add(comdatabase);
		pn1.add(pnphu1);
		
		JPanel pnphu2=new JPanel();
		pnphu2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
		JLabel userdatabase=new JLabel("UserDB");
		userdatabase.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 16));
		comUser.setPreferredSize(new Dimension(320, 25));
		pnphu2.add(userdatabase);
		pnphu2.add(comUser);
		pn1.add(pnphu2);
		
		JPanel pnphu3=new JPanel();
		pnphu3.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 3));
		JLabel passdatabse=new JLabel("PassDB");
		passdatabse.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 14));
		pxtdatabase.setPreferredSize(new Dimension(320, 25));
		pnphu3.add(passdatabse);
		pnphu3.add(pxtdatabase);
		pn1.add(pnphu3);
		
	}
}
